Name :
Example5 : RSI

Variables : name,type,value
p,Integer,14

Description :
This example computes the Relative Strength Index.

Formula :
REM Computes the daily variations

UP = MAX(0, close - close[1])
DOWN = MAX(0, close[1] - close)

REM Computes the moving average of gains on positive days
REM and losses on negative days

upMA = wilderAverage[p](UP)
downMA = wilderAverage[p](DOWN)

REM Now we can compute the RS

RS = upMA / downMA

REM And finally the RSI

myRSI = 100 - 100 / (1 + RS)

RETURN myRSI AS "Relative Strength Index"


